<template>
  <div class="detail">
    <div
      class="goods-item"
      v-for="(item, index) in categoryDetail"
      :key="index"
    >
      <a :href="item.link">
        <img v-lazy="item.image" alt="" @load="imageLoad" />
        <div class="goods-info">
          <p>{{ item.title }}</p>
        </div>
      </a>
    </div>
  </div>
</template>

<script>
export default {
  name: "CategoryRightDetailItem",
  components: {},
  props: {
    categoryDetail: {
      type: Array,
      default: [],
    },
  },
  created() {
    // console.log(this.categoryDetail);
  },
  methods: {
    imageLoad() {
      this.$bus.$emit("itemImageLoad");
    },
  },
  computed: {
    showImage() {
      return this.categoryDetail.image;
    },
    push() {
      return this.categoryDetail.link;
    },
  },
};
</script>

<style scoped>
.detail {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-around;
}

.goods-item {
  padding-bottom: 40px;
  position: relative;
  width: 33%;
}

.goods-item img {
  width: 100%;
  border-radius: 5px;
}

.goods-info {
  font-size: 12px;
  position: absolute;
  bottom: 5px;
  left: 0;
  right: 0;
  overflow: hidden;
  text-align: center;
}

.goods-info p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 3px;
}
</style>